
<script src="/echarts.min.js"></script>
<div class="layui-body" style="margin-left:-170px;margin-top: -40px">
    <div id="layuiBody" style="padding: 15px;">
        <div style="padding: 20px; background-color: #F2F2F2; ">
            <div class="layui-row layui-col-space15">
                <div class="layui-col-md4"style="width: 1000px;margin-left:240px">
                    <div class="layui-card">
                        <div class="layui-card-header">最近人数总计</div>
                        <div class="layui-card-body">
                            <div id="renshu" style="height: 600px;width: 100%"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<table class="layui-hide" id="dataTable"></table>
</div><!-- 用户列表部分 -->
<script type="text/javascript">
    layui.use(["table", "jquery", "form", "laydate", "upload"], function () {//引入layui模块
        var table = layui.table, $ = layui.jquery, form = layui.form, laydate = layui.laydate, upload = layui.upload;//初始化

        var myChart = echarts.init(document.getElementById('renshu'));
        option = {
        };
        var Piename=[];
        var PieValue=[];
        $.ajax({
            type:"post",
            async:"true",
            url:"/Chenck/chenckban",
            data:[],
            dataType:"json",
            success: function (pie) {
                $.each(pie, function (i, n) {
                    Piename.push(n.name)
                    PieValue.push(n.value)
                })
                myChart.setOption({
                    title: {
                        text: '公司员工业绩一览',
                        subtext: '数据来自王经理'
                    },
                    tooltip: {
                        trigger: 'axis',
                        axisPointer: {
                            type: 'shadow'
                        }
                    },
                    legend: {
                        data: ['2017年', '2018年']
                    },
                    grid: {
                        left: '3%',
                        right: '4%',
                        bottom: '3%',
                        containLabel: true
                    },
                    xAxis: {
                        type: 'value',
                        boundaryGap: [0, 0.01]
                    },
                    yAxis: {
                        type: 'category',
                        data: Piename
                    },
                    series: [
                        {
                            name: '2017年',
                            type: 'bar',
                            data: pie
                        },
/*                        {
                            name: '2018年',
                            type: 'bar',
                            data: pie
                        }*/
                    ]
                });
            }
        });
    });
</script>
